package com.app.service.impl;


import com.app.mapper.CusWorkExperienceMapper;
import com.app.mapper.UserPolicyInfoMapper;
import com.app.model.CusWorkExperienceModel;
import com.app.model.JobPublishModel;
import com.app.model.UserPolicyInfoModel;
import com.app.service.*;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.List;


/**
 * @Description:政策匹配信息
 */
@Service
public class UserPolicyInfoServiceImpl implements UserPolicyInfoService {
    @Autowired
    UserPolicyInfoMapper userPolicyInfoMapper;

    @Override
    public UserPolicyInfoModel getModelByUserId(int userId) {
        QueryWrapper<UserPolicyInfoModel> queryWrapper = new QueryWrapper<>();
        queryWrapper.select().eq("user_id", userId);
        List<UserPolicyInfoModel> userList = userPolicyInfoMapper.selectList(queryWrapper);
        if (userList.isEmpty()) {
            return null;
        } else {
            return userList.get(0);
        }
    }

    @Override
    public void insert(UserPolicyInfoModel model) {
        userPolicyInfoMapper.insert(model);
    }

    @Override
    public void update(UserPolicyInfoModel model) {
     userPolicyInfoMapper.updateById(model);
    }
}